<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>
        后台管理系统
    </title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="./css/x-admin.css" media="all">
    <link rel="stylesheet" href="./lib/layui/css/layui.css">
</head>
<body>
<div class="x-body">
    <form class="layui-form layui-form-pane" action="/importcourse"  enctype="multipart/form-data" method="post" >
        <input type="file" class="layui-input-inline" name="file"/>
        <input type="submit" class="layui-btn layui-btn-normal"  value="导入Excel">

    </form>
    <c:if test="${s!=null}">
    <script>
        var index= parent.layer.getFrameIndex(window.name);
        //关闭当前frame
        parent.layer.close(index);
    </script>
    </c:if>
</div>

    <script src="./lib/layui/layui.js" charset="utf-8">
    </script>
    <script src="./js/x-layui.js" charset="utf-8"></script>
    <script src="./js/common.js" charset="utf-8"></script>
    <script>
        layui.use(['form','layer','layedit'], function(){
            $ = layui.jquery;
            var form = layui.form()
                ,layer = layui.layer
                ,layedit = layui.layedit;

            //监听提交
            form.on('submit(add)',function (data) {
                console.log(data.field)
                let res=post('/importclasses',data.field);
                if(res.code==0){
                    layer.alert('操作成功！',{icon:6},function (){
                        //获得frame 索引
                        var index= parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                    });
                }else layer.alert('失败',{icon:5});
                return false;
            });
        });
    </script>
</body>
</html>
